package com.wn.product;

import com.wn.User;
import com.wn.confirm.ProductConfirm;
import com.wn.dead.DeadProduct;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @author yellow Docter
 * @date 2023 -07-25
 * @desc
 *  死信队列的测试
 */
@SpringBootTest
public class RabbitMQTest06 {

    @Autowired
    private DeadProduct deadProduct;

    @Test
    public void demo01(){
        deadProduct.send("中奖了，60000w");
    }


    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Test
    public void demo02(){

        User user = User.builder().name("hello").age(30).build();

        rabbitTemplate.convertAndSend(
                "exchange-dlx",
                "dlx",
                    user
        );

    }

    @Test
    public void demo03(){

        rabbitTemplate.convertAndSend(
                "exchange-demo",
                    "offer",
                "中500w不知道怎么花..."
        );

    }
}